//
//  FYAqiViewModel.swift
//  FYWeather
//
//  Created by D on 2017/12/7.
//  Copyright © 2017年 D. All rights reserved.
//

import UIKit

class BAAqiViewModel: NSObject {
    
    class func aqiValueWithQlty(value: String) -> String{
        var qltyText = ""
        guard let qltyInt = Double(value) else {
            printDebug("error: aqiViewModel")
            return ""
        }
        switch qltyInt {
        case 0...50:
            qltyText = localizedString("LOCALIZABLE_Excellent")
        case 51...100:
            qltyText = localizedString("LOCALIZABLE_Good")
        case 101...150:
            qltyText = localizedString("LOCALIZABLE_LightlyPolluted")
        case 151...200:
            qltyText = localizedString("LOCALIZABLE_ModeratelyPolluted")
        case 201...300:
            qltyText = localizedString("LOCALIZABLE_HeavilyPolluted")
        case 301...:
            qltyText = localizedString("LOCALIZABLE_SeverelyPolluted")
        default: break
        }
        
        return qltyText
        
    }
    
    
    class func aqiValueWithColor(value: String) -> [CGColor] {
        
        var color1 = UIColor("#E9ECF2").cgColor
        var color2 = UIColor("#7D8CA0").cgColor
        guard let qltyInt = Double(value) else {
            return [color1 , color2]
        }
        switch qltyInt {
        case 0...50:
            color1 = UIColor("#71DC08").cgColor
            color2 = UIColor("#00CA34").cgColor
        case 51...100:
            color1 = UIColor("#E7DB1E").cgColor
            color2 = UIColor("#ECBB12").cgColor
        case 101...150:
            color1 = UIColor("#F0A91F").cgColor
            color2 = UIColor("#F0781F").cgColor
        case 151...200:
            color1 = UIColor("#F26E45").cgColor
            color2 = UIColor("#F13E79").cgColor
        case 201...300:
            color1 = UIColor("#D528E5").cgColor
            color2 = UIColor("#A640E7").cgColor
        case 301...:
            color1 = UIColor("#D20783").cgColor
            color2 = UIColor("#AD1555").cgColor
        default: break
        }
        
        return [color1 , color2]
        
    }
    
}

